home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 2
/
Atari Mega Archive CD - Volume 2.iso
/
8bit
/
cislib_b
/
othell
< prev
next >
Wrap
Text File
|
1995-04-22
|
7KB
|
118 lines
3 Q0=0:Q1=1:Q2=2:Q4=4:Q5=3:Q6=6:Q7=7:Q9=9:Q10=10:Q11=11:Q12=12:Q14=14:Q15=3000:Q17=5:Q18=15:Q31=31:Q35=35:Q40=40:Q42=42:Q44=44
4 Q45=45:Q50=50:Q54=54:Q55=55:Q70=70:Q72=72:Q77=77:Q88=88:Q101=101:Q102=3100:Q120=120:Q200=3200:Q255=255:Q401=3400:Q501=8500
5 Q740=3740:Q755=755:Q764=764
35 Dim Board(Q101),P(Q101),Pie(Q1),Yesno$(Q2),Legal(Q9)
40 Graphics Q2:? #Q6:? #Q6:? #Q6:? #Q6:? #Q6;" OTHELLO"
50 ? "DO YOU WANT INSTRUCTIONS (Y/N)";
51 If Peek(Q764)=Q35 Then ? :? :Goto 500
52 If Peek(Q764)=43 Then Goto Q55
53 Goto 51
55 Graphics Q0
60 ? "REVERSI is a game played on an 8 by 8 board by two players who alternately place pieces to capture other ";
70 ? "pieces."
90 ? "Capturing is done by pinching your opponent's pieces between your own. A player must capture pieces if ";
100 ? " possible."
120 ? "When players have no more captures, the game ends. The player with more pieces wins."
130 ? "Choosing the location of your move is done by using the curser keys ";: For X=28 To Q31:? Chr$(27);Chr$(X);:Next X
150 ? " when you are happy, press the space bar and the computer will put your piece on that location."
160 ? "If you are not sure about how to play,when asked how many human players, reply 0(zero) and you can ";
170 ? "watch the computer play itself"
180 ? "If you cannot move, or you wish the computer to move for you, press 'N' and the move will be made."
500 Poke Q764,Q255:? "HOW MANY HUMAN PLAYERS (0-2)";
510 If Peek(Q764)=Q255 Then 510
520 If Peek(Q764)=Q50 Then Players=Q0:? "0"
530 If Peek(Q764)=Q31 Then Players=Q1:? "1"
540 If Peek(Q764)=30 Then Players=Q2:? "2"
600 ? "STAND BY....."
620 Data 0,0,0,0,0,0,0,0,0,0,0,7,2,6,6,6,6,2,7,0,0,2,1,3,3,3,3,1,2,0,0,6,3,4,4,4,4,3,6,0
624 Data 0,6,3,4,4,4,4,3,6,0,0,6,3,4,4,4,4,3,6,0,0,6,3,4,4,4,4,3,6,0
628 Data 0,2,1,3,3,3,3,1,2,0,0,7,2,6,6,6,6,2,7,0,0,0,0,0,0,0,0,0,0,0
630 For X=Q0 To 99:Read Y:P(X)=Y:Next X
640 Data -10,-9,1,11,10,9,-1,-11,0
650 For X=Q1 To Q9:Read Y:Legal(X)=Y:Next X:Drawcell=8000:Drawcellp=8100:Grid=8400:Keyread=Q501:Autoplay=3700
910 Let One=Q1:Zero=Q0:Pie(Zero)=Q2:Pie(One)=Q2
2000 Graphics Q7:Setcolor Q1,Q4,8:Setcolor Q2,Q12,Q10:Poke 752,Q1:? "";:Setcolor Q5,Q4,Q4:Gosub Grid
2030 P=Q1:Cell=Q44:Gosub Drawcellp:Cell=Q55:Gosub Drawcellp:P=Q2:Cell=Q45:Gosub Drawcellp:Cell=Q54:Gosub Drawcellp
2100 For I=Q11 To Q88:Board(I)=Zero:Next I
2110 For I=Zero To Q9:Board(I)=-Q1:Board(I+90)=-Q1:Board(I*Q10)=-Q1:Board(I*Q10+Q9)=-Q1:Next I
2120 Board(Q44)=Q1:Board(Q55)=Q1:Board(Q45)=Q2:Board(Q54)=Q2:Curc=Q2:Curx=26:Cury=Q70:Gosub Drawcell
2210 Curc=Q5:Curx=129:Cury=Q70:Gosub Drawcell
3000 If Pie(Zero)+Pie(One)=64 Or Pie(One)=Zero Or Pie(Zero)=Zero Then 4000
3005 Poke Q77,Q0:? "";" ";Pie(One),,," ";Pie(Zero):If Curp=Zero Then ? " << TURN "
3007 If Curp=One Then ? " TURN >>"
3010 Setcolor Q1+Curp,Q4,Q0:Sound Q0,Q255,Q10,Q10: For Y=Q1 To Q40:Next Y:Setcolor Q1+Curp,Q4,Q14:Sound Q0,Q0,Q0,Q0
3020 Setcolor Q1,Q4,Q4:Setcolor Q2,Q12,Q10:If Curp=Zero Then Setcolor Q0,Q4,Q4
3023 If Curp=One Then Setcolor Q0,Q12,Q10
3025 If Players=Zero Or Players=One And Curp=One Then Goto Autoplay
3030 Curcell=Q44:Curx=Zero:Cury=Zero:Goto Q200
3100 Gosub Keyread:If Dc=Zero Then Goto Q401
3107 Curcell=Curcell+Dc:If Board(Curcell)=Zero Then Goto Q200
3120 If Board(Curcell)<Zero Then Curcell=Curcell-Dc:Goto Q102
3200 Color Shade:Plot Curx,Cury:Drawto Curx+Q2,Cury:Plot Curx,Cury+One:Drawto Curx+Q2,Cury+One
3310 Cury=Int(Curcell/Q10):Curx=Curcell-Q10*Cury:Curx=Q44+Q10*(Curx-Q1):Cury=Q4+Q9*(Cury-Q1):Locate Curx,Cury,Shade
3340 Color Shade+One:Plot Curx,Cury:Drawto Curx+Q2,Cury:Plot Curx,Cury+One:Drawto Curx+Q2,Cury+One
3350 Sound Q0,Q50,Q10,Q10: For X=Q1 To 20:Next X:Sound Q0,Q0,Q0,Q0:Goto Q102
3400 If Board(Curcell)<>Q0 Then Goto Q200
3450 Cell=Curcell:P=Curp+Q1:Gosub Drawcellp:Curp=One-Curp:Pie(Curp)=Pie(Curp)+One:Board(Curcell)=One-Curp+Q1
3480 Curc=One-Curp+Q2:Gosub Drawcell:Total=Zero:Play=Zero
3520 Play=Play+One:Incr=Legal(Play):If Incr<>Q0 Then Gosub 3600:Goto 3520
3580 If Total=Zero Then Curp=Q1-Curp:Board(Curcell)=Q0:Curc=Q0:Gosub Drawcell:Goto Q200
3590 Goto Q15
3600 Spot=Q0:Pieces=Q0
3610 Spot=Spot+Incr:If Board(Curcell+Spot)=One+Curp Then Pieces=Pieces+One:Goto 3610
3620 If Board(Curcell+Spot)<>Board(Curcell) Or Pieces=Q0 Then Return
3630 Spot=Spot-Incr
3640 Cury=Int((Curcell+Spot)/Q10):Curx=Curcell+Spot-Q10*Cury:Board(Curcell+Spot)=Board(Curcell)
3645 Pie(Curp)=Pie(Curp)+One:Pie(One-Curp)=Pie(One-Curp)-One:Curx=Q42+Q10*(Curx-Q1):Cury=Q2+Q9*(Cury-Q1)
3660 P=One:Gosub Drawcell:Spot=Spot-Incr:Total=Total+One:If Spot=Zero Then Return
3680 Goto 3640
3700 Max=Zero: For Curcell=Q11 To Q88:If Board(Curcell)<>Zero Then Goto Q740
3711 Play=Zero:Poke Q755,Q5
3712 Play=Play+One:Incr=Legal(Play):If Incr=Zero Then Goto Q740
3713 If Board(Curcell+Incr)=Q1 Or Board(Curcell+Incr)=Q2 Then 3720
3715 Goto 3712
3720 Total=Zero:Play=Zero
3725 Play=Play+One:Incr=Legal(Play):If Incr<>Q0 Then Gosub 3800:Goto 3725
3728 If Total>Zero Then Total=Total+P(Curcell)
3730 If Total>Max Then Cnew=Curcell:Max=Total
3735 If Total=Max And Rnd(Zero)>0.5 Then Cnew=Curcell
3740 Poke Q755,Q2:Next Curcell:Curcell=Cnew:If Max=Zero Then Curp=One-Curp:Goto Q15
3750 Goto Q401
3800 Spot=Zero:Pieces=Zero
3810 Spot=Spot+Incr:If Board(Curcell+Spot)=Q2-Curp Then Pieces=Pieces+One:Goto 3810
3820 If Board(Curcell+Spot)<>One+Curp Or Pieces=Zero Then Return
3830 Spot=Spot-Incr
3840 Spot=Spot-Incr:Total=Total+P(Curcell+Spot):If Spot=Zero Then Return
3850 Goto 3840
4000 Poke Q77,Q0:? "";" ";Pie(One),,," ";Pie(Zero):If Pie(Zero)<Pie(One) Then ? " << ":?
4007 If Pie(Zero)>Pie(One) Then ? " >>":?
4008 If Pie(Zero)=Pie(One) Then ? "TIE GAME!!}}":Goto 4030
4010 ? "THE WINNER WAS PLAYER #";:If Pie(One)>Pie(Zero) Then ? One
4020 If Pie(One)<Pie(Zero) Then ? Q2
4030 Poke Q764,Q255:? "ANOTHER GAME";:Input Yesno$:If Yesno$(Q1,Q1)="Y" Then Run
4040 Graphics Q0:? :? "CALLING MENU.....":Run "D:MENU"
8000 Color Curc:Plot Curx+Q2,Cury:Drawto Curx+Q4,Cury:Plot Curx+Q1,Cury+Q1:Drawto Curx+Q17,Cury+Q1
8040 Plot Curx,Cury+Q2:Drawto Curx+Q6,Cury+Q2:Plot Curx,Cury+Q5:Drawto Curx+Q6,Cury+Q5
8060 Plot Curx+Q1,Cury+Q4:Drawto Curx+Q17,Cury+Q4:Plot Curx+Q2,Cury+Q17:Drawto Curx+Q4,Cury+Q17:If P=Q0 Then Return
8080 For I=Q10 To 200 Step Q10:Sound Q0,I,Q0,Q18:Next I: For I=Q18 To Q0 Step 0.25:Sound Q0,210,Q0,I:Next I
8090 Sound Q0,Q0,Q0,Q0:Return
8100 Rem
8110 Curc=P+Q1:Cury=Int(Cell/Q10):Curx=Cell-Q10*Cury:Curx=Q42+Q10*(Curx-Q1):Cury=Q2+Q9*(Cury-Q1):Goto Drawcell
8400 Color Q1: For Y=Q0 To Q72 Step Q9:Sound Q0,Y,Q10,Q10:Plot Q40,Y:Drawto Q120,Y:Next Y
8430 For X=Q40 To Q120 Step Q10:Sound Q0,100+X,Q10,Q10:Plot X,Q0:Drawto X,Q72:Next X:Sound Q0,Q0,Q0,Q0:Return
8500 Poke Q764,Q0:Dc=Zero
8520 P=Peek(Q764):If P=Q6 Then Dc=-Q1
8522 If Stick(Q0)=Q11 Then Dc=-Q1
8530 If P=Q7 Then Dc=Q1
8532 If Stick(Q0)=Q7 Then Dc=Q1
8540 If P=Q18 Then Dc=Q10
8542 If Stick(Q0)=13 Then Dc=Q10
8550 If P=Q14 Then Dc=-Q10
8552 If Stick(Q0)=Q14 Then Dc=-Q10
8560 If P=33 Then Return
8562 If Strig(Q0)=Q0 Then Return
8565 If P=21 Then Gosub 5000:Goto Q501
8567 If P=Q35 Then Color Shade:Plot Curx,Cury:Drawto Curx+Q2,Cury:Plot Curx,Cury+One:Drawto Curx+Q2,Cury+One:Goto 370
8570 If Dc=Zero Then 8520
8590 Return